<?php
/**
 * @package contenite/samples
 */
?><dl id="user">
<?php
if (isset($_SESSION['user'])) {
?>
  <dt><?php echo ($avatar = $_SESSION['user']->avatar()) ? "<img src=\"{$avatar}\" width=\"24\" height=\"24\" />" : ''; ?> <strong><?php 
    echo '<a title="Your personal page" href="', $_SESSION['user']->id, '">', $_SESSION['user']->email, '</a>'; ?></strong> <a title="logout" href="/user/logout">[x]</a></dt>
<?php
}
else {
?>
  <dt class="form"><?php echo __('Login / Register'); ?></dt>
  <dd>
    <form id="account" action="/user/login" method="POST">
      <label for="email"><?php echo __('E-Mail'); ?>:
        <input class="email" name="email" value="<?php echo data('email'); ?>"/>
      </label>
<?php
/**
 * This will be hidden by CSS and used as an 'inverse' captcha. 
 * If it is filled in, this is seen as a sign for a break-in attempt.
 */
?>
      <input class="email2" name="email2" />
      <label for="password"><?php echo __('Password'); ?>:
        <input class="password" name="password" type="password" value="<?php echo data('password'); ?>"/>
      </label>
      <div id="register">
        <label for="password2"><?php echo __('Password (repeated)'); ?>:
          <input name="password2" type="password" value="<?php echo data('password2'); ?>"/>
        </label>
        <label for="name"><?php echo __('Your name'); ?>:
          <input name="name" value="<?php echo data('name'); ?>"/>
        </label>
        <a id="password" href="/user/password" 
          title="Enter your email address and let us sent you a new password"><?php echo __('Password lost?'); ?></a> |
        <a id="show_login" href="#"
          title="Click to login with an existing account"><?php echo __('Login'); ?></a>
        <button type="submit"><?php echo __('Register'); ?></button>
      </div>
      <div id="login">
        <a id="remind" href="/user/password"
          title="Enter your email address and let us sent you a new password"><?php echo __('Password lost?'); ?></a> |
        <a id="show_register" href="#"
          title="Click to register"><?php echo __('Register'); ?></a>
        <button type="submit"><?php echo __('Login'); ?></button>
      </div>
    </form><!--#account-->
  </dd>
<?php
}
?>
</dl><!--#forms-->
